package codeComposition;

public class VarAssignElement extends ExpressionElement {
	ReferenceElement var;
	ReferenceElement to;
	
	public VarAssignElement(int tabNum){
		super(tabNum);
	}
	public VarAssignElement(ReferenceElement var, ReferenceElement to){
		this.to = to;
		this.var = var;
		tabStr = "";
	}
	
	public VarAssignElement(ReferenceElement var, ReferenceElement to, int tabNum){
		super(tabNum);
		this.to = to;
		this.var = var;
	}
	public VarAssignElement(String var, String to){
		this.to = new ReferenceElement(to);
		this.var = new ReferenceElement(var);
		tabStr = "";
	}
	
	public VarAssignElement(String var, String to, int tabNum){
		super(tabNum);
		this.to = new ReferenceElement(to);
		this.var = new ReferenceElement(var);
	}
	
	public String toString(){
		return tabStr + to.toString() + " = " + var.toString() + "\n";
	}
	
	public static void main(String[] argvs){
		ReferenceElement to = new ReferenceElement("to");
		ReferenceElement var = new ReferenceElement("var");
		VarAssignElement lae = new VarAssignElement(var, to);
		VarAssignElement lae2 = new VarAssignElement(var, to, 2);
		System.out.println(lae.toString() + lae2.toString() + lae.getRawString() + lae2.getRawString());
	}
}
